package com.heo.protocol.packet;

import org.apache.log4j.Logger;
import com.heo.pub.DictEnum;
import com.heo.util.ByteHelper;

public class LoginOutResp extends BasePacket
{
  private int BODY_LENGTH = 2;// 包体长2个字节

  private static final String PACKET_NAME = "[退出登录应答包]";

  private static Logger log = Logger.getLogger(LoginOutResp.class);

  private short resultCode = DictEnum.ResultCode.SUCCESS;

  public LoginOutResp() throws Exception
  {
    super(PACKET_NAME);
  }
  
  @Override
  public int getTotalLength()
  {
    return super.HEAD_LENGTH + BODY_LENGTH;
  }

  public LoginOutResp(short resultCode, short sequenceId) throws Exception
  {
    super(PACKET_NAME);
    this.resultCode = resultCode;
    super.totalLength = (short) (HEAD_LENGTH + BODY_LENGTH);
    super.commandId = DeviceCommand.LOGINOUT_RESP;
    super.sequenceId = sequenceId;
  }

  @Override
  public byte[] getPacketBody()
  {
    return ByteHelper.margeByte(ByteHelper.shortToByteArray(resultCode), null, null, null, null, null, null, null, null, null);
  }

  public static void main(String[] args)
  {

  }

  @Override
  public void makeBody()
  {

  }

  public short getResultCode()
  {
    return resultCode;
  }

  public void setResultCode(short resultCode)
  {
    this.resultCode = resultCode;
  }

}
